from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from time import sleep

s=Service(r"/Users/didi1/Desktop/chromedriver.exe")
wb=webdriver.Chrome(service=s)
wb.implicitly_wait(10)
# r:表示后面的路径不存在转译
wb.get('https://www.baidu.com')
# 获取当前选中的元素
ac=ActionChains(wb)
ac.move_to_element(wb.find_element(By.XPATH,'//*[@id="s-top-left"]/div/a')).perform()
sleep(5)
wb.quit()